package com.yp.infrastructure.common.exception;


import lombok.Getter;

/**
 * Created by tju on 6/27/17.
 */

@Getter
public abstract class BaseException extends RuntimeException {
    protected ErrorMessage errorMessage;
    private BaseException() {}

    protected BaseException(ErrorMessage errorMessage) {
        this.errorMessage = errorMessage;
    }

    protected BaseException(IErrorMessage enumErrorMessage) {
        this.errorMessage = ErrorMessageUtils.toErrorMessage(enumErrorMessage);
    }
    protected BaseException(IErrorMessage errorMessage, Exception e) {
        this.errorMessage = ErrorMessageUtils.toErrorMessage(errorMessage, e.getMessage());
    }

    protected BaseException(IErrorMessage errorMessage, Throwable throwable) {
        this.errorMessage = ErrorMessageUtils.toErrorMessage(errorMessage, throwable.getMessage());
    }


}
